import 'package:flutter/material.dart';
import 'package:flutter_app10/configs/app_style_config.dart';
import 'package:flutter_app10/models/homepage/xbb_cell_model.dart';
import 'package:flutter_app10/view/homepage/pub_title_cell_widget.dart';
import 'package:flutter_app10/view/homepage/xbb_cell_widget.dart';



class XbbPage extends StatefulWidget {
  @override
  _XbbPageState createState() => _XbbPageState();
}

class _XbbPageState extends State<XbbPage> {

  List dataSource = [
    {"name":"DF","price":"0.9663","amplitude":-11.63},
    {"name":"GNX","price":"0.032923","amplitude":0.89},
    {"name":"FLOW","price":"28.7186","amplitude":-2.35},
    {"name":"NSURE","price":"1.0122","amplitude":10.18},
    {"name":"WOO","price":"0.35364","amplitude":-12.19},
    {"name":"WOO","price":"0.00064350","amplitude":-6.89},
    {"name":"VALUE","price":"5.7019","amplitude":-10.72},
    {"name":"SNC","price":"0.00000084","amplitude":-5.34},
    {"name":"BADGER","price":"49.1994","amplitude":-9.18},
    {"name":"SUSHI","price":"19.2721","amplitude":13.67},
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: AppStyleConfig.themColor,
      body: ListView.builder(
        shrinkWrap: true, //为true可以解决子控件必须设置高度的问题
        physics: NeverScrollableScrollPhysics(),
        itemBuilder: (context, index) {
          if(index == 0){
            return PhbTitleCellWidget(title1: "名称",title2: "最新价(USDT)",title3: "涨跌幅",);
          }
          return XbbCellWidget(dataModel: XbbCellModel.fromJson(dataSource[index-1]),showBottomBorder: index == dataSource.length ? false : true,);
        },
        itemCount: dataSource.length + 1,
      ),
    );
  }
}
